finding the mod of negative numbers